<?php

class PreregCaseForm extends Zend_Form
{
	public function __construct( $options=array() )
	{
        parent::__construct($options);
		
		// default decorators
        $decorators = array(
            'ViewHelper',
            array('Errors', array('placement'=>'prepend')),
            array(array('labelBr'=>'HtmlTag'), array('tag'=>'br')),
            array('Label', array('placement'=>'prepend')),
            array( array('outerDiv'=>'HtmlTag'), array('tag'=>'div', 'style'=>'margin-top:5px')),
        );
		
        $this->setName('preregform');
        $this->setMethod('post');
				
		// FH identification field
		$fFH = new Zend_Form_Element_Hidden('branch_id');
		$fFH->setValue($options['branch']);
		
		// add field-set here
		// decedent fields
		$fDecedentFirstName = new Zend_Form_Element_Text('decedent_fname', 
			array('required'=>true, 'label'=>"First Name", 'size'=>30 ));		
		$fDecedentFirstName->setValue('');
		$fDecedentFirstName->setDecorators( $decorators );		
		$fDecedentMiddleName = new Zend_Form_Element_Text('decedent_mname', array('required'=>false, 'label'=>"Middle Name", 'size'=>30 ));
		$fDecedentMiddleName->setDecorators( $decorators );		
		$fDecedentLastName = new Zend_Form_Element_Text('decedent_lname', array('required'=>true, 'label'=>"Last Name", 'size'=>30 ));
		$fDecedentLastName->setDecorators( $decorators );
		$fDecedentSex = new Zend_Form_Element_Text('decedent_sex', array('required'=>true, 'label'=>"Sex", 'size'=>8 ));
		$fDecedentSex->setDecorators( $decorators );
		$fDecedentDOB = new Zend_Form_Element_Text('decedent_dob', array('required'=>true, 'label'=>"Date Born", 'size'=>12 ));
		$fDecedentDOB->setDecorators( $decorators );
		$fDecedentDOD = new Zend_Form_Element_Text('decedent_dod', array('required'=>true, 'label'=>"Date Deceased", 'size'=>12 ));
		$fDecedentDOD->setDecorators( $decorators );
		$fDecedentAddress = new Zend_Form_Element_Text('decedent_address', array('required'=>true, 'label'=>"Address", 'size'=>48 ));
		$fDecedentAddress->setDecorators( $decorators );
		$fDecedentCity = new Zend_Form_Element_Text('decedent_city', array('required'=>true, 'label'=>"City", 'size'=>32 ));
		$fDecedentCity->setDecorators( $decorators );
		$fDecedentState = new Zend_Form_Element_Text('decedent_state', array('required'=>true, 'label'=>"State", 'size'=>2 ));
		$fDecedentState->setDecorators( $decorators );
		
		// add field set here
		// informant fields
		$fContactFirstName = new Zend_Form_Element_Text('contact_fname', array('required'=>true, 'label'=>"First Name", 'size'=>30 ));
		$fContactFirstName->setDecorators( $decorators );
		$fContactMiddleName = new Zend_Form_Element_Text('contact_mname', array('required'=>false, 'label'=>"Middle Name", 'size'=>30 ));
		$fContactMiddleName->setDecorators( $decorators );
		$fContactLastName = new Zend_Form_Element_Text('contact_lname', array('required'=>true, 'label'=>"Last Name", 'size'=>30 ));
		$fContactLastName->setDecorators( $decorators );
		$fContactAddress = new Zend_Form_Element_Text('contact_address', array('required'=>true, 'label'=>"Address", 'size'=>48 ));
		$fContactAddress->setDecorators( $decorators );
		$fContactCity = new Zend_Form_Element_Text('contact_city', array('required'=>true, 'label'=>"City", 'size'=>32 ));
		$fContactCity->setDecorators( $decorators );
		$fContactState = new Zend_Form_Element_Text('contact_state', array('required'=>true, 'label'=>"State", 'size'=>2 ));
		$fContactState->setDecorators( $decorators );
		$fContactPhone = new Zend_Form_Element_Text('contact_phone', array('required'=>true, 'label'=>"Phone", 'size'=>16 ));
		$fContactPhone->setDecorators( $decorators );
		$fContactEmail = new Zend_Form_Element_Text('contact_email', array('required'=>false, 'label'=>"Email", 'size'=>48 ));
		$fContactEmail->setDecorators( $decorators );
		$fContactRelation = new Zend_Form_Element_Text('contact_relation', array('required'=>true, 'label'=>"Relationship to Deceased", 'size'=>16 ));
		$fContactRelation->setDecorators( $decorators );
		
		// clear/submit buttons
		$bClear = new Zend_Form_Element_Reset('clear');
		$bSubmit = new Zend_Form_Element_Submit('submit');
		
		$this->addElements( array( $fFH ) );
		
		$this->addElements( 
			array(
				$fDecedentFirstName,
				$fDecedentMiddleName,
				$fDecedentLastName,
				$fDecedentSex,
				$fDecedentDOB,
				$fDecedentDOD,
				$fDecedentAddress,
				$fDecedentCity,
				$fDecedentState
			)
		);
				
		$this->addDisplayGroup( array(
			'decedent_fname', 'decedent_mname', 'decedent_lname',
			'decedent_sex', 'decedent_dob', 'decedent_dod',
			'decedent_address', 'decedent_city', 'decedent_state' ), 'deceased',
			array( 'legend'=>'Deceased') );
			
		$this->addElements( 
			array(
				$fContactFirstName,
				$fContactMiddleName,
				$fContactLastName,
				$fContactAddress,
				$fContactCity,
				$fContactState,
				$fContactPhone,
				$fContactEmail,
				$fContactRelation
			)
		);
		$this->addDisplayGroup( 
			array(
				'contact_fname',
				'contact_mname',
				'contact_lname',
				'contact_address',
				'contact_city',
				'contact_state',
				'contact_phone',
				'contact_email',
				'contact_relation' ), 'first_contact',
			array( 'legend'=>' First Contact ') );
		
		
		$this->addElements( array( $bClear, $bSubmit ) );
	}
	
	public function render_with_template( $template_name )
	{
	}
}

?>